package com.robot.controller;

import com.robot.common.result.Response;
import com.robot.dao.dto.DictDTO;
import com.robot.dao.vo.DictDataVO;
import com.robot.service.DictDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dict")
@Slf4j
@Api(tags = "数据字典")
public class DictDataController {

    @Autowired
    private DictDataService dictDataService;

    @PostMapping("/queyr")
    @ApiOperation("根据数据类型查询数据字典")

    public Response<List<DictDataVO>> getDictData(@RequestBody DictDTO dictDTO) {
        List<DictDataVO> dictData = dictDataService.selectDictDataByType(dictDTO.getDictType());
        return Response.success(dictData);

    }

}
